﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CapaDeEntidades;
using CapaNegocio;

namespace Biblioteca
{
    public partial class Principal : System.Web.UI.Page
    {

        public object SocioLogueado
        {
            get { return Session["Socio"]; }
            set { Session["Socio"] = value; }
        }

        void Page_PreInit(object sender, EventArgs e)
        {

            //string userSocio = Request.QueryString["UserSocio"].ToString();

            Socio socio = (Socio)Session["Usuario"];
            SocioLogueado = socio;


            if (socio.Usuario == "admin")
            {
                MasterPageFile = "~/MasterPageAdministrador.Master";
            }
            else
            {
                MasterPageFile = "~/MasterMenu.Master";
            }
        }



        protected void Page_Load(object sender, EventArgs e)
        {
            this.PreInit += new EventHandler(Page_PreInit);
            Socio socio = (Socio)SocioLogueado;
            dtPrestamos.DataSource = Controladora.ObtenerPrestamosPorSocio(socio.Codigo);
            dtPrestamos.DataBind();
            dtReservas.DataSource = Controladora.ObtenerReservasPorSocio(socio.Codigo);
            dtReservas.DataBind();
        }





    }
}
